"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const index_1 = require("../utils/index");
class UploadCtl {
    static async uploadImg(ctx) {
        let file;
        const { request } = ctx;
        const { body, query } = request;
        if (ctx.request.files) {
            file = ctx.request.files.file;
            const path = query.path || "path";
            const res = await index_1.uploadFile(file, path);
            if (res) {
                ctx.body = index_1.dealDbMessage(res);
                return;
            }
        }
        ctx.body = index_1.dealDbMessage(null, 500, "上传照片失败");
    }
}
exports.default = UploadCtl;
